import {wxRequest} from '../../../utils/server.js';
const _wxRequest = new wxRequest();
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  onShow:function(){
    this.getStoreShared()
  },

  //表单提交
  formSubmit: function (e) {
    var formdata = e.detail.value; 
    formdata.stoId = wx.getStorageSync('userInfo').orgId
    formdata.shared = formdata.shared?1:0

    // if (formdata.requestReason == '') {
    //   wx.showToast({
    //     icon: 'none',
    //     title: '申请理由不能为空',
    //   })
    //   return
    // }
 
     
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/org/protected/bizOrg/storeSharedSetting',
      method: 'POST',
      data: formdata
    }, (res) => {
      wx.showToast({
        title: '提交申请成功',
      })
      setTimeout(() => {
        wx.switchTab({
          url: '/pages/menber/index',
        })
      }, 1500)
    })
  },

  //获取分销信息
  getStoreShared:function(){ 
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/org/protected/bizOrg/getStoreShared?stoId='+ wx.getStorageSync('userInfo').orgId,
      method: 'POST', 
    }, res => {
      console.log(res)
      this.setData({
         detail:res.vo 
      })
    })
  }



})